<?php

namespace App\Providers;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // 需要打印 sql 时，打开下面注释
        /*DB::listen(function ($query) {
            $sql = $query->sql;
            foreach ($query->bindings as $binding) {
                $sql = preg_replace('/\?/', $binding, $sql, 1);
            }
            echo $sql.PHP_EOL.PHP_EOL.PHP_EOL;
        });*/
    }
}
